package com.google.android.material.transformation;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

public abstract class ExpandableTransformationBehavior extends ExpandableBehavior {
    @Nullable
    private AnimatorSet ˋ;

    @NonNull
    protected abstract AnimatorSet ˎ(View view, View view2, boolean z, boolean z2);

    public ExpandableTransformationBehavior(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    @CallSuper
    protected boolean ˋ(View view, View view2, boolean z, boolean z2) {
        boolean z3 = this.ˋ != null;
        if (z3) {
            this.ˋ.cancel();
        }
        this.ˋ = ˎ(view, view2, z, z3);
        this.ˋ.addListener(new AnimatorListenerAdapter(this) {
            final /* synthetic */ ExpandableTransformationBehavior ˋ;

            {
                this.ˋ = r1;
            }

            public void onAnimationEnd(Animator animator) {
                this.ˋ.ˋ = null;
            }
        });
        this.ˋ.start();
        if (!z2) {
            this.ˋ.end();
        }
        return true;
    }
}
